from django.shortcuts import render
from rest_framework.generics import ListAPIView
from rest_framework.views import APIView
from rest_framework.viewsets import ModelViewSet

from coupons.serializers import *
from .models import *

# 优惠券视图集
class CouponsViewSet(ModelViewSet):
    queryset = Coupon.objects.all()
    serializer_class = Coupon_Serializer
    lookup_field = 'pk'
    lookup_url_kwarg = 'pk'


# 优惠券类型list
class CouponTypeList(ListAPIView):
    queryset = CouponType.objects.all()
    serializer_class = CouponType_Serializer



